﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Liger.Web.Common;
using Liger.Web.Common.Extensions;

namespace Liger.Web.UI
{
    public class SpinnerBuilder : UIComponentBuilderBase, IHideObjectMembers
    {
        private Spinner Spinner
        {
            get
            {
                return this.Component as Spinner;
            }
        }


        public SpinnerBuilder()
            : base(new Spinner())
        {

        }

        public SpinnerBuilder(Spinner Spinner)
            : base(Spinner)
        {

        }

        /// <summary>
        /// 设置属性
        /// </summary>
        /// <param name="property"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public SpinnerBuilder Set(string property, object value)
        {
            if (this.Spinner.Properties.ContainsKey(property))
            {
                this.Spinner.Properties[property] = value;
            }
            else
            {
                this.Spinner.Properties.Add(property, value);
            }
            return this;
        }

        /// <summary>
        /// 返回ligerSpinner的Manager
        /// </summary>
        /// <param name="manager">manager的对象名</param>
        /// <returns></returns>
        public SpinnerBuilder Manager(string manager)
        {
            this.Spinner.Manager = manager;
            return this;
        }


        public SpinnerBuilder Type(string value)
        {
            this.Spinner.Type = value;
            return this;
        }
        public SpinnerBuilder IsNegative(bool value)
        {
            this.Spinner.IsNegative = value;
            return this;
        }
        public SpinnerBuilder Decimalplace(int value)
        {
            this.Spinner.Decimalplace = value;
            return this;
        }
        public SpinnerBuilder Step(int value)
        {
            this.Spinner.Step = value;
            return this;
        }
        public SpinnerBuilder Interval(int value)
        {
            this.Spinner.Interval = value;
            return this;
        }
        public SpinnerBuilder MinValue(string value)
        {
            this.Spinner.MinValue = value;
            return this;
        }
        public SpinnerBuilder MaxValue(string value)
        {
            this.Spinner.MaxValue = value;
            return this;
        }
        public SpinnerBuilder Disabled(bool value)
        {
            this.Spinner.Disabled = value;
            return this;
        }
    }
}